<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
	<title>业务处理-采购管理-待采购物资</title>
	<meta charset="utf-8">
	<link rel="stylesheet" type="text/css" href="<%=basePath %>libs/bootstrap-3.3.7-dist/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="<%=basePath %>css/reset.css">
	<link rel="stylesheet" type="text/css" href="<%=basePath %>css/style.css">
	<link rel="stylesheet" type="text/css" href="<%=basePath %>css/iframe.css">
</head>
<body>
	<header id="mainHeader"></header>
	<div id="mainContent">
		<div id="mainContent_content">
			<div class="page_header"><a>采购申请审批</a></div>
			<div class="search">
			<form action="<%=basePath %>audit/listPurchaseRequestAudit.do" method="post" class="form">
				<input type="hidden" name="currentPage" value="1">
				<p>
					<label>申请单号</label>
					<input type="text" class="form-control" name="applicationNo" value="${page.applicationNo }"></input>
					<label>提交人</label>
					<input type="text" class="form-control" name="loginName" value="${page.loginName }"></input>
					<label>状态</label>
					<select name="status" class="form-control select">
						<option value="">全部</option> 
						<option value="0"<c:if test="${page.status==0 }"> selected </c:if>>审批中</option>
						<option value="1"<c:if test="${page.status==1 }"> selected </c:if>>审批通过</option>
						<option value="2"<c:if test="${page.status==2 }"> selected </c:if>>审批拒绝</option>
					</select>
					<span class="btn">
						<input type="submit" value="搜索" class="btn btn1"></input>
					</span>
				</p>
			</form>
			</div>
			<div class="tableBox box">
				<table class="table table-bordered table_text_center">
					<thead>
						<tr>
							<th style="width:150px;"></th>
							<th>申请单号</th>
							<th>申请人</th>
							<th>审核组</th>
							<th>当前审核人</th>
							<th>通过审核员</th>
							<th>拒绝审核员</th>
							<th>状态</th>
						</tr>
					</thead>
					<tbody>
					<c:forEach items="${list}" var="list"> 
						<tr>
						<td>
						<c:if test="${list.isCurrentRole>0 && list.isChecked==0 && list.status==0 }">
							<a class="btn btn-xs btn1" onclick="passapprove(${list.id});">通过</a>
							<a class="btn btn-xs btn_danger" onclick="rejectapprove(${list.id});">拒绝</a>
						</c:if>
						</td>
						<td>${list.applicationNo}</td>
						<td>${list.loginName}</td>
						<td>${list.roleName}</td>
						<td>${list.listnames}</td>
						<td>${list.auditPassUsername}</td>
						<td>${list.auditRejectUsername}</td>
						<c:if test="${list.status==0}"><td>审批中</td></c:if>
						<c:if test="${list.status==1}"><td>审批通过</td></c:if>
						<c:if test="${list.status==2}"><td>审批拒绝</td></c:if>
						</tr>
						</c:forEach>
					</tbody>
				</table>
			</div>
			<jsp:include page="/jsp/basic/page.jsp"></jsp:include>
		</div>
		<jsp:include page="/jsp/basic/prompt.jsp"></jsp:include>
	</div>
	<script src="<%=basePath %>js/jquery-3.2.1.min.js"></script>
	<script src="<%=basePath %>libs/bootstrap-3.3.7-dist/js/bootstrap.js"></script>
	<script src="<%=basePath %>My97DatePickers/WdatePicker.js"></script>
	<script src="<%=basePath %>js/public.js"></script>
</body>
<script type="text/javascript">
	//通过审批
	function passapprove(id){
		 $.ajax({
				url:"<%=basePath%>audit/updatepassapproveRequestAudit.do",
				type:"post",
				async : false,
				dataType : "json",
				data : "id="+id,
				success:function(data){
					Prompt.alert("提示","已通过！",Prompt.refresh);
				},
				error :function(){
					//$("#add_inventory_location_msg").html("新增物品分类失败！")
				}
			});
	 }
	//拒绝审批
	 function rejectapprove(id){

		 $.ajax({
				url:"<%=basePath%>audit/updaterejectapproveRequestAudit.do",
				type:"post",
				async : false,
				dataType : "json",
				data : "id="+id,
				success:function(data){
					/* if(data.result='success'){
						alert("OK");
					} */
					Prompt.alert("提示","已拒绝！",Prompt.refresh);
				},
				error :function(){
					//$("#add_inventory_location_msg").html("新增物品分类失败！")
				}
			});
	 }
</script>
</html>